<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title></title>
		<style type="text/css">
			body{
				background: #CCCCCC;
			}
			#btn{
				display: block;
				margin: 0 auto;
				width: 200px;
				height: 40px;
			}
			#uname{
				font-size: 100px;
				text-align: center;
				font-weight: 700;
			}
		</style>
		<script type="text/javascript">
			window.onload = function(){
				//1.抓元素
				var btn = document.getElementById("btn");
				var uname = document.getElementById("uname");
				//3.设置随机颜色
				var c1 = Math.floor(Math.random()*120);
				var c2 = Math.floor(Math.random()*120);
				var c3 = Math.floor(Math.random()*120);
				//2.给按钮点击事件
				btn.onclick = function(){
					uname.style.color = "rgb("+c1+","+c2+","+c3+")";
				}
			}
		</script>
	</head>
	<body>
		<p id="uname">万策智业</p>
		<button id="btn">点我呀~</button>
	</body>
</html>
